package me.ywy.kotlinvideo.ui.fragment

import android.os.Bundle
import android.preference.Preference
import android.preference.PreferenceFragment
import android.preference.PreferenceScreen
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import me.ywy.kotlinvideo.R
import me.ywy.kotlinvideo.ui.activity.AboutActivity
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast

/**
 * Created by ywy on 2018-11-02.
 */
class SettingFragment: PreferenceFragment() {

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
        addPreferencesFromResource(R.xml.setting)
        return super.onCreateView(inflater, container, savedInstanceState)
    }

    override fun onPreferenceTreeClick(preferenceScreen: PreferenceScreen?, preference: Preference?): Boolean {

        when(preference?.key){
            "clear_cache"->{
                //清除缓存
            }

            "about"->{
                //关于
                startActivity<AboutActivity>()
            }
        }

        return super.onPreferenceTreeClick(preferenceScreen , preference)
    }



}